package com.xjl.myapplication;

import android.os.Bundle;
import android.widget.TextView;

import com.xjl.remotelink.RemoteLinkManager;
import com.xjl.remotelink.server.ServerCallback;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    private TextView tv;

    @Override
    protected void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv = findViewById(R.id.tv);
        findViewById(R.id.btn).setOnClickListener(v -> {
            RemoteLinkManager.getInstance().createServer(1234, new ServerCallback() {
                @Override
                public void onReceiveData (String data) {
                    tv.setText(data);
                    getMessageWatcher().sendResult("亮度为255");
                }
            });
        });
    }
}